//
//  ButtonAndLabels.m
//  LearnToHelp
//
//  Created by mc on 16/6/2.
//  Copyright © 2016年 Elliot. All rights reserved.
//

#import "ButtonAndLabels.h"

#define BtbAndLabelsWeith [UIScreen mainScreen].bounds.size.width/2

@implementation ButtonAndLabels

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.userInteractionEnabled = YES;

        [self addButtonAndLabelsUI];
//        self.backgroundColor = [UIColor blackColor];
    }
    return self;
}


-(void)addButtonAndLabelsUI {
    self.backgroundColor = [UIColor whiteColor];
    CGFloat weith = CGRectGetWidth(self.frame);
    CGFloat height = CGRectGetHeight(self.frame);

    
    self.FirstLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 , 10, weith, height/2-10)];
    self.FirstLabel.font = [UIFont systemFontOfSize:14];
    self.FirstLabel.textAlignment = NSTextAlignmentCenter;
    self.FirstLabel.textColor = [UIColor blackColor];
    self.FirstLabel.backgroundColor = [UIColor clearColor];
    [self addSubview:self.FirstLabel];
    
    self.SecondLable = [[UILabel alloc] initWithFrame:CGRectMake(0, height/2, weith, height/2)];
    self.SecondLable.font = [UIFont systemFontOfSize:14];
    self.SecondLable.textAlignment = NSTextAlignmentCenter;
    self.SecondLable.textColor = [UIColor blackColor];
    self.SecondLable.backgroundColor = [UIColor clearColor];
    [self addSubview:self.SecondLable];
    
    
    self.lineView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.frame) - 2, CGRectGetHeight(self.frame)/4, 1, CGRectGetHeight(self.frame)/2)];
    _lineView.backgroundColor = BaseColor;
    [self addSubview:_lineView];
    
    [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(buttonClick:)]];
    
}
- (void)buttonClick:(UITapGestureRecognizer *)tap {
    
    [self.delegate buttonViewbtnClick:(self.tag)];
    
    
    
}
    


@end
